﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

using ExtAspNet;

public partial class Module_CustServerManger_CustServerList : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

        Button9.OnClientClick = Window2.GetShowReference("../CustManger/CustSearchCondition.aspx", "客户查找条件");

        Button1.OnClientClick = "AddTab('Module/CustServerManger/CustServerDetail.aspx', 'CustServer_CustServerDetailed', '客户服务详细信息')";

        if (!IsPostBack)
        {

            PreLoadGvList();

        }

    }



    private void PreLoadGvList()
    {
        if (Request.QueryString["StaffID"] != null)
        {
            int ServerStaffID = Convert.ToInt32(Request.QueryString["StaffID"]);
            LoadGvlist(ServerStaffID);
        }
        else
        {
            LoadGvlist(-1);
        }
    }



    private void LoadGvlist(int ServerStaffID)
    {
        Ylh.BLL.CustBLL bllc = new Ylh.BLL.CustBLL(DbConnectionStr);

        Grid1.DataSource = bllc.GetCustList(ServerStaffID);
        Grid1.DataBind();
    }



    protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
    {
        System.Web.UI.WebControls.LinkButton lbf = (System.Web.UI.WebControls.LinkButton)Grid1.Rows[e.RowIndex].FindControl("lbfAction1");
      
        string str = Grid1.DataKeys[e.RowIndex][0].ToString();
        lbf.OnClientClick = "AddTab('Module/CustServerManger/CustServerDetail.aspx?CustID=" + str + "', 'CustServer_CustServerDetailed', '客户服务详细信息')";
    }

    protected void BtnDel_Click(object sender, EventArgs e)
    {
        List<string> li = base.GetCheckID(Grid1);
        Ylh.BLL.CustBLL bllc = new Ylh.BLL.CustBLL(DbConnectionStr);

        bllc.deleteCust(li);
        PreLoadGvList();
        Alert.Show("删除成功");





    }
}